
<!-- 用于展示的评论区-->
<div th:each="commentVo:${articleComments}" class="area_comment_look"
	style="overflow: hidden; background-color: #fff;">
	<div th:classappend="PComment+${commentVo?.comment?.commentId}">
		<input type="hidden"
			th:classappend="username+${commentVo?.comment?.commentId}"
			th:value="${commentVo?.username}">
		<div class="area_comment_message">
			<div class="layui-col-md1 image_icon">
				<!-- 评论人的头像 -->
				<a th:href="'/user/other/'+${commentVo?.username}" target="_blank">
					<image class="comment-user-icon user-icon"
						th:src="@{${commentVo?.userIcon}}" src="/images/bajie-1.jpg" />
				</a>
			</div>
			<a th:text="${commentVo?.username}" class="names01 user-name"
				th:href="'/user/other/'+${commentVo?.username}" target="_blank">大帅比</a>
			<span th:text="${commentVo?.comment?.createTime}"
				class="comment_look_time">2020-01-10 12:33:25</span> 
				
				
			<div class="comment_look_support c" th:value="${commentVo?.comment?.commentId}" style="width: 55px;"onclick="doSupport($(this).attr('value'))">
				<text class="iconfont icon-zan" style="font-size: 18px; "></text>
				<span th:text="${commentVo?.comment?.likes}!=0?${commentVo?.comment?.likes}:''" class="commentLikes"></span>
			</div>
				
				
			<div id="art_look_for">
				<a th:text="'查看回复（'+${commentVo?.sonCommentNum+'）'}"
					th:value="${commentVo?.comment?.commentId}"
					onclick="showReply($(this).attr('value'))" 
						style="display:block; margin-right: 20px;"
					class="comment_look_select show" href="javascript:void(0);">查看回复 </a>
					<a th:value="${commentVo?.comment?.commentId}"
					onclick="closeReply($(this).attr('value'))"
					class="comment_look_select comment_look_close" href="javascript:void(0);" style=" margin: 6px 28px 0 0px; display:none;">收起回复 </a>
			</div>
			<div id="comment-opt-bar2" style="display: none;     margin-right: 136px;" class="comment-opt-bar2 p" >
				<a class="comment_look_delete"
					th:value="${commentVo?.comment?.commentId}"
					onclick="showCommentUser($(this).attr('value'))"
					href="javascript:void(0);">回复</a> <a
					th:if="${commentVo?.comment?.userId} == ${userId}"
					class="comment_look_delete" href="javascript:void(0);"
					th:value="${commentVo?.comment?.commentId}"
					onclick="delectPComment($(this).attr('value'))">删除</a>
			</div>
		</div>
		<div th:text="${commentVo?.comment?.commentText}"
			class="comment_look_text">这里是对文章的评论内容:长太息以掩涕兮，哀民生之多艰，余虽好修姱以鞿羁兮，謇朝谇而夕替，既替余以蕙纕兮，又申之以揽茝。
		</div>

		<div
			th:classappend="commentParentFoot+${commentVo?.comment?.commentId}">
		</div>
	</div>
</div>
	<script type="text/javascript">
	//显示删除、回复
	$(document).ready(function(){
		$(".area_comment_look").hover(function(){
			$(this).find('.comment-opt-bar2.p').css('display','block');
		},function(){
			$(this).find('.comment-opt-bar2.p').css('display','none');
		})
	//初始化页面时，展示点赞信息
		var l=$("#likeCommentIdList").val().slice(1,-1);
		arr=l.split(",");
		for(let i=0;i<arr.length;i++){
			$(".PComment"+arr[i].trim()).find(".comment_look_support.c").css("color","rgb(202, 12, 22)");
		}
	})
			//点赞操作(注：下面class完全不一样)
		function doSupport(commentId){
			var userId=$('#userId').val();
				$.ajax({
					type : "GET",
					url : "/user/power/do-comment-like",
					data : {
						commentId : commentId,
						userId : userId,
					},
					dataType : "JSON",
					success : function(result) {
						if(result.data==1){
							$(".PComment"+commentId).find(".comment_look_support.c").css("color","rgb(202, 12, 22)");
							var likesNum=$(".PComment"+commentId).find(".commentLikes").text();
							//likesNum = parseInt(likesNum) + 1;
							$(".PComment"+commentId).find(".commentLikes").text(++likesNum);
						}else if(result.data==0){
						$(".PComment"+commentId).find(".comment_look_support.c").css("color","#4d4d4d");
						var likesNum=$(".PComment"+commentId).find(".commentLikes").text();
						var likeNum2=--likesNum==0?"":likesNum;
						$(".PComment"+commentId).find(".commentLikes").text(likeNum2);
						}
					}
				});
			}
				
	</script>

